package en.edu.lzzy.bookmanagement.repository;

import en.edu.lzzy.bookmanagement.model.Book;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface BookRepository extends JpaRepository<Book, Long> {
    // 定义了两个方法用于实现根据关键字进行标题和作者模糊搜索，并返回一个带有分页结果的Page对象
    Page<Book> findByTitleContaining(String keyword, Pageable pageable);
    Page<Book> findByAuthorContaining(String keyword, Pageable pageable);

//    Page<Book> findByTitleContainingIgnoreCase(String keyword, Pageable pageable);
//
//    Page<Book> findByAuthorContainingIgnoreCase(String keyword, Pageable pageable);
//
//    Page<Book> findByCategory_NameContainingIgnoreCase(String keyword, Pageable pageable);

}
